import 'package:shared_preferences/shared_preferences.dart';

class OnboardingService {
  static const String _firstLaunchKey = 'first_launch';
  static OnboardingService? _instance;
  final SharedPreferences _prefs;

  OnboardingService._(this._prefs);

  static Future<OnboardingService> getInstance() async {
    if (_instance == null) {
      final prefs = await SharedPreferences.getInstance();
      _instance = OnboardingService._(prefs);
    }
    return _instance!;
  }

  Future<bool> isFirstLaunch() async {
    return _prefs.getBool(_firstLaunchKey) ?? true;
  }

  Future<void> completeOnboarding() async {
    await _prefs.setBool(_firstLaunchKey, false);
  }
}
